import React from 'react';
import PropTypes from 'prop-types';
import { Form, Input } from 'antd';
import classNames from 'classnames';
import styles from '../index.less';

const { Item } = Form;
const { TextArea } = Input;

// HR确认申请
const Ceo = ({ form, type, detail, processState }) => {
    const { getFieldDecorator } = form;
    return (
        <div>
            <div className={styles.title}>转正评估（区域CEO）</div>
            <div className={classNames({ [styles.detailWrap]: type === 'detail' })}>
                <Item label="意见或建议" help={type !== 'detail' && processState !== 'success' ? '0-400个字符' : ''}>
                    {type === 'edit' &&
                        processState === 'doing' &&
                        getFieldDecorator('ceoToApproval', {
                            initialValue: detail.ceoToApproval,
                            rules: [
                                {
                                    max: 400,
                                    message: '0-400个字符'
                                }
                            ]
                        })(<TextArea placeholder="请输入意见或建议" rows={4} />)}
                    {(type === 'detail' || processState !== 'doing') &&
                        getFieldDecorator('ceoToApproval', {
                            initialValue: detail.ceoToApproval
                        })(<span>{detail.ceoToApproval}</span>)}
                </Item>
            </div>
        </div>
    );
};

Ceo.propTypes = {
    type: PropTypes.oneOf(['edit', 'detail']).isRequired
};

export default Ceo;
